Kanzi  3.9.7
Kanzi Engine API
kanzi::NodeEffect2D Class Referenceabstract

Use node effects to apply post-processing effects to 2D nodes. More...

#include <kanzi/core.ui/node/node_effect2d.hpp>

Inheritance diagram for kanzi::NodeEffect2D:
[legend]

Public Member Functions

NodeEffectRenderer2DUniquePtr createRenderer ()
 Creates a renderer instance. More...
 
unsigned int getEffectPaddingChangeCounter () const
 Gets the effect quad change counter. More...
 
Vector4 getEffectQuadPadding () const
 Gets the effect quad padding. More...
 
Vector2 getEffectQuadPaddingOffset () const
 Gets the effect quad offset relative relative to the top-left corner of the node. More...
 
Vector2 getEffectQuadPaddingSize () const
 Gets the effect quad padding size. More...
 
NodeEffectRenderer2DgetRendererInstance () const
 Gets a pointer to NodeEffectRenderer2D instance or null pointer if none exists. More...
 
bool isAlphaRequired () const
 Indicates whether the effect requires alpha channel for the result. More...
 
bool isRenderingRequired ()
 Indicates whether the effect requires rendering. More...
 
void unregisterEffectRenderer (NodeEffectRenderer2D *effectRenderer)
 Unregister effect renderer. More...
 
 ~NodeEffect2D ()
 
- Public Member Functions inherited from kanzi::Resource
virtual unsigned int getCPUMemoryUsage () const
 Function for getting the memory usage of a resource. More...
 
const string & getName () const
 Gets the resource name. More...
 
const string & getUrl () const
 Gets the resource URL. More...
 
bool isKeepAlive () const
 Tells if the resource has keep alive flag set. More...
 
void reload ()
 
void reloadFromFile (string_view filePath)
 
void reloadFromKzb (KzbFile &kzbFile, ReadOnlyMemoryFile &file, KzbMemoryParser &parser)
 
void setKeepAlive (bool keepAlive)
 Sets the keep alive flag. More...
 
void setUrl (string_view url)
 Sets the resource URL. More...
 
 ~Resource () override
 Destructor. More...
 
- Public Member Functions inherited from kanzi::Object
AppliedStyleEntrySharedPtr applyObjectStyle (kanzi::StyleSharedPtr style)
 Applies a style to an object. More...
 
void applyObjectStyles ()
 Apply all styles for an object node. More...
 
DomaingetDomain () const
 Returns the domain the object belongs to. More...
 
const MetaclassgetDynamicMetaclass () const override
 Returns the metaclass of the dynamic type of the object. More...
 
MainLoopSchedulergetMainLoopScheduler () const
 Returns the MainLoopScheduler instance of the associated Domain. More...
 
detail::MessageDispatcher * getMessageDispatcher () const
 Returns the message dispatcher of the object. More...
 
ResourceManagergetResourceManager () const
 Returns the resource manager of the object. More...
 
ScriptingContextSharedPtr getScriptingContext () const
 Gets the scripting context of the object. More...
 
 Object (Domain *domain)
 
void setScriptingContext (ScriptingContextSharedPtr context)
 Sets the scripting context of the object. More...
 
void unapplyObjectStyle (AppliedStyleEntrySharedPtr appliedStyleEntry)
 
void unapplyObjectStyles ()
 Unapplies and removes all applied styles. More...
 
 ~Object () override
 
- Public Member Functions inherited from kanzi::MetaObject
bool isTypeOf (const Metaclass *objectType) const
 Determines if the type of this object is the given type or derived from it. More...
 
virtual ~MetaObject ()
 
- Public Member Functions inherited from kanzi::PropertyObject
template<typename DataType >
void addPropertyModifier (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner)
 
template<typename DataType >
void addPropertyModifierWithoutNotifyingHandlers (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner)
 Adds a property modifier without notifying handlers. More...
 
template<typename DataType >
void addPropertyNotificationHandler (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::NotificationCallback callback, void *owner)
 
template<typename DataType >
void addPropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, PropertyValuePrecedence precedence, void *ownerPointer)
 
template<typename DataType >
void addPropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, PropertyValuePrecedence precedence, AbstractPropertyTypeDescriptor::ValueSourceOwner *owner)
 
PropertyStorageContainer::iterator beginPropertyStorage ()
 Returns the begin iterator to the internal property storage container. More...
 
PropertyStorageContainer::const_iterator beginPropertyStorage () const
 Returns the begin iterator to the internal property storage container. More...
 
void clearPropertyFlag (AbstractPropertyType propertyType, uint32_t flag)
 
void copyLocalValue (const PropertyObject &other, AbstractPropertyType propertyType)
 Copies local value of single property from another object. More...
 
void copyLocalValues (const PropertyObject &other)
 Copies all local values from another object. More...
 
PropertyStorageContainer::iterator endPropertyStorage ()
 Returns the end iterator to the internal property storage container. More...
 
PropertyStorageContainer::const_iterator endPropertyStorage () const
 Returns the end iterator to the internal property storage container. More...
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getAbstractProperty (AbstractPropertyType abstractPropertyType) const
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getAbstractPropertyBase (AbstractPropertyType abstractPropertyType) const
 
template<typename DataType >
optional< typename PropertyType< DataType >::Traits::ReturnType > getOptionalAbstractProperty (AbstractPropertyType abstractPropertyType) const
 
template<typename DataType >
optional< typename PropertyType< DataType >::Traits::ReturnType > getOptionalProperty (const PropertyType< DataType > &propertyType) const
 Evaluates the property value in the same way as the overload above but does not default to the value in property metadata if there are no inputs to the property value. More...
 
template<typename DataType >
optional< typename PropertyType< DataType >::Traits::ReturnType > getOptionalPropertyBase (const PropertyType< DataType > &propertyType) const
 Returns the current value of a property disregarding modifiers, but does not default to the value in property metadata if there are no inputs to the property value. More...
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getProperty (const PropertyType< DataType > &propertyType) const
 Returns the current value of a property type. More...
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getPropertyBase (const PropertyType< DataType > &propertyType) const
 Returns the current value of a property disregarding modifiers. More...
 
template<typename DataType >
size_t getPropertyNotificationHandlerCount (const PropertyType< DataType > &propertyType) const
 Gets number of current notification handlers for given property type. More...
 
bool hasBaseValue (AbstractPropertyType propertyType) const
 Evaluates whether there are any inputs into the property value, disregarding modifiers. More...
 
bool hasLocalValue (AbstractPropertyType propertyType) const
 Evaluates whether there is a local value set for the property. More...
 
bool hasNonClassValue (AbstractPropertyType propertyType) const
 Evaluates whether there is a value of any precedence higher than class default value set for the property. More...
 
bool hasValue (AbstractPropertyType propertyType) const
 Evaluates whether there are any inputs into the property value. More...
 
bool isPropertyFlagSet (AbstractPropertyType propertyType, uint32_t flag) const
 
virtual void onPropertyChanged (AbstractPropertyType propertyType, PropertyNotificationReason reason)
 Virtual function to handle property change notifications. More...
 
 PropertyObject ()
 
void removeKzbProperties (flat_set< AbstractPropertyType > *keepProperties)
 Remove all KZB properties that are not included in a given set. More...
 
void removeKzbProperties ()
 Remove all KZB properties. More...
 
template<typename DataType >
void removeLocalPropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, void *ownerPointer)
 
void removeLocalValue (AbstractPropertyType propertyType)
 Removes the local value associated with the property. More...
 
template<typename DataType >
void removePropertyModifier (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner)
 
template<typename DataType >
void removePropertyNotificationHandler (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::NotificationCallback callback, void *owner)
 
template<typename DataType >
void removePropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, void *ownerPointer)
 
template<typename DataType >
void setAbstractProperty (AbstractPropertyType abstractPropertyType, typename PropertyType< DataType >::Traits::ParameterType value)
 
template<typename DataType >
void setProperty (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Traits::ParameterType value)
 Sets the local value of a property type. More...
 
void setPropertyFlag (AbstractPropertyType propertyType, uint32_t flag)
 
KZ_DEPRECATED void validatePropertyModifiers (AbstractPropertyType propertyType)
 Validates property modifiers and notifies handlers. More...
 
void validatePropertyModifiersAndNotifyHandlers (AbstractPropertyType propertyType)
 Validates property modifiers and notifies handlers. More...
 
virtual ~PropertyObject ()
 

Protected Member Functions

virtual NodeEffectRenderer2DUniquePtr createRendererOverride ()=0
 Creates a renderer instance. More...
 
virtual void initializeRendererOverride ()=0
 Initializes a previously created renderer instance. More...
 
virtual bool isRenderingRequiredOverride ()
 Implementation-dependent check on whether effect rendering is required. More...
 
 NodeEffect2D (Domain *domain, string_view name)
 Constructor. More...
 
void setAlphaRequired (bool required)
 Sets the framebuffer alpha channel requirements of the effect. More...
 
void setEffectQuadPadding (float left, float right, float top, float bottom)
 Sets the padding required by the effect around the node bounds during the rendering of the effect. More...
 
- Protected Member Functions inherited from kanzi::Resource
virtual unsigned int getCPUMemoryUsageOverride () const
 
virtual void reloadFromFileOverride (string_view filePath)
 
virtual void reloadFromKzbOverride (KzbFile &kzbFile, ReadOnlyMemoryFile &file, KzbMemoryParser &parser)
 
virtual void reloadOverride ()
 
 Resource (Domain *domain, string_view name)
 Constructor. More...
 
- Protected Member Functions inherited from kanzi::Object
void initialize ()
 
void onCopy (const Object &other)
 
- Protected Member Functions inherited from kanzi::MetaObject
void initialize ()
 
 MetaObject ()
 
- Protected Member Functions inherited from kanzi::PropertyObject
AbstractPropertyTypeDescriptor::ValueSourceEntryacquireLocalValueSourceEntry (AbstractPropertyTypeDescriptor &descriptor, PropertyStoragePtr &propertyStorage)
 Acquires a local value source entry that is free for the assignment of a value. More...
 
AbstractPropertyTypeDescriptor::ModifierStorageacquireModifierStorage (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::PropertyStorage &propertyStorage)
 
AbstractPropertyTypeDescriptor::NotificationStorageacquireNotificationStorage (AbstractPropertyTypeDescriptor &descriptor)
 
PropertyStoragePtr acquirePropertyStorage (AbstractPropertyTypeDescriptor &descriptor)
 
template<typename DataType >
void addPropertyModifierBase (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner, bool notify)
 Adds a property modifier entry to the property modifier stack and validates them. More...
 
void addPropertyValueSource (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::ValueSource *valueSource, PropertyValuePrecedence precedence, void *ownerPointer)
 Internally adds a property value source. More...
 
void addPropertyValueSource (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::ValueSource *valueSource, PropertyValuePrecedence precedence, AbstractPropertyTypeDescriptor::ValueSourceOwner *owner)
 Internally adds a property value source. More...
 
AbstractPropertyTypeDescriptor::ValueSourceEntryconstructLocalValueSourceEntry (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::PropertyStorage &propertyStorage)
 
PropertyStoragePtr constructPropertyStorage (AbstractPropertyTypeDescriptor &descriptor)
 
void copyLocalValue (const AbstractPropertyTypeDescriptor::PropertyStorage &otherPropertyStorage)
 Copy local value from property storage. More...
 
AbstractPropertyTypeDescriptor::ModifierStoragefindModifierStorage (AbstractPropertyTypeDescriptor &descriptor)
 
AbstractPropertyTypeDescriptor::NotificationStoragefindNotificationStorage (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::PropertyStoragefindPropertyStorage (AbstractPropertyTypeDescriptor &descriptor) const
 Gets the property storage for given property type descriptor. More...
 
PropertyStoragePtr findPropertyStoragePtr (AbstractPropertyTypeDescriptor &descriptor) const
 Gets property storage intrusive pointer which you can use to hold a reference until the end of the operation. More...
 
AbstractPropertyTypeDescriptorfindPropertyTypeDescriptorByNameAndDataType (string_view name, PropertyDataType dataType) const
 Finds a property type descriptor by name and data type. More...
 
AbstractPropertyTypeDescriptorfindPropertyTypeDescriptorByQualifiedNameAndDataType (string_view qualifiedName, PropertyDataType dataType) const
 Like findPropertyTypeDescriptorByNameAndDataType, but only searches by matching with qualified names. More...
 
AbstractPropertyTypeDescriptorfindPropertyTypeDescriptorByUnqualifiedNameAndDataType (string_view unqualifiedName, PropertyDataType dataType) const
 Like findPropertyTypeDescriptorByNameAndDataType, but only searches by matching with unqualified names. More...
 
AbstractPropertyTypeDescriptor::ValueSourcegetClassValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourcegetFinalValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourcegetNonClassValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourcegetTopValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 Gets the top-level value source for a given property descriptor. More...
 
virtual void notifyPropertyHandlers (PropertyStoragePtr &storagePtr, PropertyNotificationReason reason)
 Notifies all property handlers on a property storage. More...
 
void onCopy (const PropertyObject &other)
 
void removeLocalValue (AbstractPropertyTypeDescriptor &descriptor, PropertyStoragePtr &propertyStorage)
 Removes a local value from the given property storage. More...
 
void removePropertyValueSource (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::ValueSource *valueSource, void *owner)
 Removes a property value source. More...
 
void validatePropertyModifiers (PropertyStoragePtr &propertyStorage)
 Validates property modifiers without notifying handlers. More...
 
void validatePropertyModifiersAndNotifyHandlers (PropertyStoragePtr &propertyStorage)
 Validates property modifiers and notifies handlers. More...
 

Additional Inherited Members

- Public Types inherited from kanzi::PropertyObject
typedef PropertyStorageContainer::const_iterator PropertyStorageConstIterator
 
typedef vector< PropertyStoragePtrPropertyStorageContainer
 
typedef PropertyStorageContainer::iterator PropertyStorageIterator
 
typedef intrusive_ptr< AbstractPropertyTypeDescriptor::PropertyStoragePropertyStoragePtr
 
typedef PropertyStorageContainer::reverse_iterator PropertyStorageReverseIterator
 
- Static Public Member Functions inherited from kanzi::Object
static const MetaclassgetStaticMetaclass ()
 Returns the metaclass of Object class. More...
 
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 Default implementation that returns empty editor info. More...
 
- Static Public Member Functions inherited from kanzi::MetaObject
static const MetaclassgetStaticMetaclass ()
 Returns the metaclass of Object class. More...
 
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 Default implementation that returns empty editor info. More...
 
- Protected Types inherited from kanzi::Object
typedef vector< AppliedStyleEntrySharedPtrAppliedStyleContainer
 Applied style container. More...
 
- Protected Attributes inherited from kanzi::Object
AppliedStyleContainer m_appliedStyles
 Listing of applied styles applied to this object. More...
 

Detailed Description

Use node effects to apply post-processing effects to 2D nodes.

Examples

To create an effect:

// An effect that is assigned to a 2D node is an effect prefab.
// Before you can construct an effect prefab, you must create an effect template.
// This example creates an effect template for the ShadowEffect2D effect prefab.
NodeEffectTemplate2DSharedPtr shadowEffectTemplate =
// Create a node effect prefab from the effect template.
NodeEffectPrefab2DSharedPtr shadowEffectPrefab =
NodeEffectPrefab2D::create(getDomain(), "DropShadow prefab", shadowEffectTemplate);

To assign an effect to a 2D node:

// To assign an effect prefab to a 2D node, set the Node2D::EffectPrefabProperty.
node2d->setProperty(Node2D::EffectPrefabProperty, shadowEffectPrefab);
// To assign an effect prefab to a 2D node, call the Node2D::setEffectPrefab method.
node2d->setEffectPrefab(shadowEffectPrefab);

To set the effect properties:

// Create an effect template.
NodeEffectTemplate2DSharedPtr shadowEffectTemplate =
// Set the value of the AngleProperty in the template. This value serves as the default value
// of the property in instances of the effect prefab.
shadowEffectTemplate->addPropertyValue(ShadowEffect2D::AngleProperty, Variant(35.f));
// Create an effect prefab.
NodeEffectPrefab2DSharedPtr shadowEffectPrefab =
NodeEffectPrefab2D::create(getDomain(), "DropShadow prefab", shadowEffectTemplate);
// Assign the effect to a 2D node.
node2d->setEffectPrefab(shadowEffectPrefab);
// Get the node-specific effect instance created from the assigned prefab.
ShadowEffect2DSharedPtr shadowEffect = dynamic_pointer_cast<ShadowEffect2D>(node2d->getEffect());
// Set the shadow distance to 15 pixels for this node only. This overrides
// the property default value defined by the ShadowEffect2D metaclass.
shadowEffect->setDistance(15.f);
// Set the direction of the shadow to 55 degrees relative to the positive x axis.
// This overrides the default value of 35 degrees set in the shadow effect template.
shadowEffect->setAngle(55.f);

To set multiple nodes to use the same effect:

// Create an effect template.
NodeEffectTemplate2DSharedPtr shadowEffectTemplate =
// Create an effect prefab from the effect template.
NodeEffectPrefab2DSharedPtr shadowEffectPrefab =
NodeEffectPrefab2D::create(getDomain(), "DropShadow prefab", shadowEffectTemplate);
// Set two nodes to use the same effect prefab. The nodes create separate instances
// of NodeEffect2D but share the same NodeEffectPrefab2D instance.
node1->setEffectPrefab(shadowEffectPrefab);
node2->setEffectPrefab(shadowEffectPrefab);

To enable and disable an effect:

// Enable an effect on a 2D node by assigning an effect prefab.
node2d->setEffectPrefab(shadowEffectPrefab);
// Disable an effect by assigning a nullptr or an empty shared pointer.
node2d->setEffectPrefab(nullptr);

To create an effect type:

// To create an effect resource type, inherit a new class from NodeEffect2D
// and define a new associated metaclass. Each effect resource class must
// have an associated renderer class inherited from NodeEffectRenderer2D.
class EmptyEffectRenderer2D;
using EmptyEffectRenderer2DUniquePtr = unique_ptr<EmptyEffectRenderer2D>;
class EmptyEffect2D;
using EmptyEffect2DSharedPtr = shared_ptr<EmptyEffect2D>;
// EmptyEffect2D defines a new effect that defines no properties
// nor padding.
class EmptyEffect2D : public NodeEffect2D
{
public:
KZ_METACLASS_BEGIN(EmptyEffect2D, NodeEffect2D, "Kanzi.EmptyEffect2D")
// Create an instance of EmptyEffect2D.
static EmptyEffect2DSharedPtr create(Domain* domain, string_view name)
{
return make_polymorphic_shared_ptr<Resource>(new EmptyEffect2D(domain, name));
}
protected:
// Constructor.
explicit EmptyEffect2D(Domain* domain, string_view name) :
NodeEffect2D(domain, name)
{
}
// NodeEffect2D::createRendererOverride implementation.
// NodeEffect2D::initializeRendererOverride implementation.
{
}
};
// EmptyEffectRenderer2D implements the rendering of the effect.
// Because this example effect does not render anything, Kanzi renders
// the original node as is.
class EmptyEffectRenderer2D : public NodeEffectRenderer2D
{
public:
// Creates an instance of MinimalEffectRenderer2D. Never call this
// function directly. Instead, use NodeEffect2D::createRenderer().
static EmptyEffectRenderer2DUniquePtr create(EmptyEffect2DSharedPtr effect)
{
return unique_ptr<EmptyEffectRenderer2D>(new EmptyEffectRenderer2D(effect));
}
private:
// Constructor.
explicit EmptyEffectRenderer2D(EmptyEffect2DSharedPtr effect) :
NodeEffectRenderer2D(effect)
{
}
// Implementation of NodeEffectRenderer2D::beginEffectOverride.
void beginEffectOverride(Renderer3D& /*renderer*/, CompositionStack& /*compositionStack*/, CompositionManager* /*compositionManager*/,
const Matrix3x3& /*worldTransform*/, const CompositionContentRequirements& /*requirements*/) override
{
}
// Implementation of NodeEffectRenderer2D::endEffectOverride.
void endEffectOverride(Renderer3D& /*renderer*/, CompositionStack& /*compositionStack*/, CompositionManager* /*compositionManager*/) override
{
}
// Implementation of NodeEffectRenderer2D::blitEffectOverride.
void blitEffectOverride(Renderer3D& /*renderer*/, CompositionStack& /*compositionStack*/, CompositionManager* /*compositionManager*/,
QuadDescription& /*effectQuad*/, const Matrix3x3& /*transform*/, const Matrix4x4* /*perspectiveMatrix*/,
const Matrix4x4* /*projectionMatrix*/, int /*blendMode*/, bool /*needsClear*/) override
{
}
// Implementation of NodeEffectRenderer2D::restoreResourcesOverride.
virtual void restoreResourcesOverride() override
{
}
};
NodeEffectRenderer2DUniquePtr EmptyEffect2D::createRendererOverride()
{
return EmptyEffectRenderer2D::create(static_pointer_cast<EmptyEffect2D>(shared_from_this()));
}
See also
NodeEffectPrefab2D, NodeEffectTemplate2D
Since
Kanzi 3.9.0

Constructor & Destructor Documentation

kanzi::NodeEffect2D::~NodeEffect2D ( )
kanzi::NodeEffect2D::NodeEffect2D ( Domain domain,
string_view  name 
)
explicitprotected

Constructor.

Parameters
domainDomain to use.
nameResource name.

Member Function Documentation

NodeEffectRenderer2DUniquePtr kanzi::NodeEffect2D::createRenderer ( )

Creates a renderer instance.

Only single renderer instance may exist.

See also
NodeEffect2D::createRendererOverride.
Returns
NodeEffectRenderer2D instance.
Vector4 kanzi::NodeEffect2D::getEffectQuadPadding ( ) const
inline

Gets the effect quad padding.

Returns
Effect quad padding as Vector4 where padding parameters are assigned as Vector4(left, right, top, bottom).
Vector2 kanzi::NodeEffect2D::getEffectQuadPaddingOffset ( ) const
inline

Gets the effect quad offset relative relative to the top-left corner of the node.

Returns
Effect quad offset as Vector2.
Vector2 kanzi::NodeEffect2D::getEffectQuadPaddingSize ( ) const
inline

Gets the effect quad padding size.

Effect quad padding size defines how much the node quad size increases because of the effect padding.

Returns
Effect quad padding size as Vector2.
unsigned int kanzi::NodeEffect2D::getEffectPaddingChangeCounter ( ) const
inline

Gets the effect quad change counter.

Kanzi updates the effect quad change count when the effect padding changes.

Returns
Effect padding change counter.
bool kanzi::NodeEffect2D::isAlphaRequired ( ) const
inline

Indicates whether the effect requires alpha channel for the result.

void kanzi::NodeEffect2D::unregisterEffectRenderer ( NodeEffectRenderer2D effectRenderer)
inline

Unregister effect renderer.

Effect renderer is automatically registered by NodeEffect2D::createRenderer() and unregistered by the NodeEffectRenderer2D destructor.

Parameters
effectRendererEffect renderer pointer to unregister.
bool kanzi::NodeEffect2D::isRenderingRequired ( )
inline

Indicates whether the effect requires rendering.

Some effect property values can eliminate the need to render the effect. Typically this reflects a situation where the effect has no visible impact.

Returns
If effect rendering is required true, otherwise false.
Since
Kanzi 3.9.5
NodeEffectRenderer2D* kanzi::NodeEffect2D::getRendererInstance ( ) const
inline

Gets a pointer to NodeEffectRenderer2D instance or null pointer if none exists.

Returns
If the NodeEffectRenderer2D instance exists, a pointer to it, otherwise null pointer.
virtual NodeEffectRenderer2DUniquePtr kanzi::NodeEffect2D::createRendererOverride ( )
protectedpure virtual

Creates a renderer instance.

Only single renderer instance may exist.

Returns
NodeEffectRenderer2D instance.

Implemented in kanzi::OutlineEffect2D, kanzi::MaskEffect2D, kanzi::ShadowEffect2D, and kanzi::BlurEffect2D.

virtual void kanzi::NodeEffect2D::initializeRendererOverride ( )
protectedpure virtual

Initializes a previously created renderer instance.

Implemented in kanzi::OutlineEffect2D, kanzi::MaskEffect2D, kanzi::ShadowEffect2D, and kanzi::BlurEffect2D.

virtual bool kanzi::NodeEffect2D::isRenderingRequiredOverride ( )
protectedvirtual

Implementation-dependent check on whether effect rendering is required.

The default implementation always returns true. Individual effects must override this function to turn themselves off.

Returns
If effect rendering is required true, otherwise false.
Since
Kanzi 3.9.5

Reimplemented in kanzi::OutlineEffect2D, kanzi::ShadowEffect2D, and kanzi::BlurEffect2D.

void kanzi::NodeEffect2D::setEffectQuadPadding ( float  left,
float  right,
float  top,
float  bottom 
)
inlineprotected

Sets the padding required by the effect around the node bounds during the rendering of the effect.

Kanzi accounts for the effect quad padding when determining the visibility of the node.

void kanzi::NodeEffect2D::setAlphaRequired ( bool  required)
inlineprotected

Sets the framebuffer alpha channel requirements of the effect.

Parameters
requiredIf the effect rendering requires alpha channel and blending, true, otherwise false.

The documentation for this class was generated from the following file: